<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@page import="java.text.SimpleDateFormat" %>
<%@ page language="java" import="java.util.*" %>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>

<%
    String path = request.getContextPath();
%>
<%
    String d = request.getParameter("d");
    if (d != null && d.equals("1")) {
        response.setHeader("Content-disposition", "attachment; filename=daochu.xls");
    }
//获取并判断浏览器信息
    String Agent = request.getHeader("User-Agent");
    if (Agent.contains("Chrome")) {
        System.out.println("Chrome");
        request.setAttribute("brtype", "cbr");
    } else {
        System.out.println("!Chrome");
        request.setAttribute("brtype", "obr");
    }
    System.out.println(Agent);
%>


<html>
<head>
    <title>title</title>
    <LINK href="qtimages/style.css" type=text/css rel=stylesheet>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    <script type="text/javascript" src="<%=path %>/js/popup.js"></script>
    <script language="JavaScript" src="<%=path %>/js/public.js" type="text/javascript"></script>
    <script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
    <script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
    <script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
    <%--<script type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js"></script>--%>
    <script language=javascript src='js/My97DatePicker/WdatePicker.js'></script>
    <%--<script type="text/javascript" src="<%=path %>/js/riqi.js"></script>--%>
    <%--1 请先登录判断--%>

    
    <script>
        <c:if test="${sessionScope.user==null}">
        javascript:alert('对不起，请您先登陆！');history.back();
        </c:if>
    </script>


    <script language="javascript">

        //计算两个日期的天数差
        function dateDiff() {

            if (document.getElementById("kaishiriqi").value == "") {
                alert("please input:起始日期");
                return false;
            }

            if (document.getElementById("jieshuriqi").value == "") {
                alert("please input:结束日期");
                return false;
            }
            var firstriqi = document.getElementById("kaishiriqi").value;
            var secondriqi = document.getElementById("jieshuriqi").value;
            var first = new Date(firstriqi);
            var second = new Date(secondriqi);
            var diff = Math.abs(first.getTime() - second.getTime())
            var result = parseInt(diff / (1000 * 60 * 60 * 24));
            //document.getElementById("jine").value = result*${requestScope.kefang.jiage };
        }

        function check() {

                            if(document.getElementById("biaoti").value=="")
                {
                    alert("please input:评语");
                    return false;
                }

                if(document.getElementById("fenshu").value=="")
                {
                    alert("please input:分数（范围1-5）");
                    return false;
                }



            document.getElementById("formAdd").submit();
        }

        function up() {
            var pop = new Popup({contentType: 1, isReloadOnClose: false, width: 400, height: 200});
            pop.setContent("contentUrl", "<%=path %>/upload/upload.jsp");
            pop.setContent("title", "文件上传");
            pop.build();
            pop.show();
        }

        function upx(id) {
            //window.open("<%=path %>/upload/upload.jsp?id="+id, "_self");
            var pop = new Popup({contentType: 1, isReloadOnClose: false, width: 400, height: 200});
            pop.setContent("contentUrl", "<%=path %>/upload/upload.jsp?id=" + id);
            pop.setContent("title", "文件上传");
            pop.build();
            pop.show();
        }

        function typechange() {

            var obj = document.getElementById("type"); //定位id				//document.getElementById(id)
            var index = obj.selectedIndex; // 选中索引
            var text = obj.options[index].text; // 选中索引值

            document.getElementById("typename").value = text; //okok

        }

        function init() {

            	           shangpinSelect();


            
        }

        	        function shangpinSelect()
	        {
	            loginService.shangpinSelect(shangpincallBack);
	        }
	        function shangpincallBack(data)
	        {
	            DWRUtil.addOptions("shangpinid",data,"id","mingcheng");
	        }
	        function usersSelect()
	        {
	            loginService.usersSelect(userscallBack);
	        }
	        function userscallBack(data)
	        {
	            DWRUtil.addOptions("usersid",data,"id","loginname");
	        }


    </script>
</head>

<body onload="init()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="1000" height="1160" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
    <tr>
        <td>
            <%@ include file="qttop.jsp" %>
        </td>
    </tr>
    <tr>
        <td>
            <table id="__01" width="1000" height="804" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td valign="top">
                        <%@ include file="qtleft.jsp" %>
                    </td>
                    <td valign="top">
                        <table id="__01" width="770" height="804" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td valign="top">
                                    <table id="__01" width="770" height="276" border="0" cellpadding="0"
                                           cellspacing="0">
                                        <tr>
                                            <td width="770" height="36" background="qtimages/1_02_02_01_01.gif">
                                                <table width="98%" height="22" border="0" cellpadding="0"
                                                       cellspacing="0">
                                                    <tr>
                                                        <td width="17%" align="center"><strong>评论添加 </strong></td>
                                                        <td width="83%">&nbsp;</td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <table id="__01" width="770" height="231" border="0" cellpadding="0"
                                                       cellspacing="0">
                                                    <tr>
                                                        <td width="11" background="qtimages/1_02_02_01_02_01.gif">
                                                            &nbsp;
                                                        </td>
                                                        <td height="759" valign="top">

                                                            <form action="<%=path %>/chanpinpingjiaAddQian.action" method="post" name="formAdd"
                                                                  id="formAdd" >
                                                                <table width="98%" border="1" align="center"
                                                                       cellpadding="3" cellspacing="1"
                                                                       bordercolor="#00CC99"
                                                                       style="border-collapse:collapse">

                                                                    						<tr>
							<td>
								评语:
						    </td>

							<td>
								<input type="text" name="biaoti" id="biaoti" size="70"/>
							</td>

						</tr>
						<tr>
							<td>
								分数（范围1-5）:
						    </td>

							<td>
								<input type="text" name="fenshu" id="fenshu" size="70"/>
							</td>

						</tr>
						<tr>
							<td>
								时间:
						    </td>

						    <td>
						        <input type="text" name="shijian" id="shijian" size="70" value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date())%>"/>
						    </td>

						</tr>
						<tr>
							<td>
								评论菜品:
						    </td>

							<td>
						        <select name="shangpinid" id="shangpinid" style=" height:19px; border:solid 1px #000000; color:#666666" >
								</select>
						    </td>

						</tr>
						<tr style="display: none">
														<td>
								评论用户:
						    </td>

														<%--<td width="80%" bgcolor="#FFFFFF" align="left">
						        <select name="usersid" id="usersid" style="width: 280px;">
								</select>
						    </td>--%>

						</tr>


                                                                    <tr>
                                                                        <td>&nbsp;</td>
                                                                        <td colspan="2">
                                                                            <input type="button" value="提交" onclick="check()"/>&nbsp;
                                                                            <input type="button" value="返回" onClick="javascript:history.back()"/>

                                                                            <%--<input type="reset" name="Submit22" value="重置"/>--%>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </form>

                                                        </td>
                                                        <td width="10" background="qtimages/1_02_02_01_02_04.gif">
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><img src="qtimages/1_02_02_01_03.gif" width="770" height="9" alt="">
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>

                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <%@ include file="qtdown.jsp" %>
        </td>
    </tr>
</table>
</body>
</html>

<script language=javascript src='js/My97DatePicker/WdatePicker.js'></script>
<script type="text/javascript" src="js/popup.js"></script>
<script language=javascript src='js/ajax.js'></script>

<%@page import="java.util.ArrayList" %>
<%@page import="java.util.HashMap" %>


